﻿<UserControl x:Class="GameFrameLibrary.DataBox"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="576" d:DesignWidth="1024">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Frames/SharedStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <!--ListBox-->
            <Style TargetType="ListBox">
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <WrapPanel Orientation="Horizontal" Margin="5" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="ListBoxItem">
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="Margin" Value="5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <Border Name="myBorder" CornerRadius="2" BorderThickness="1" BorderBrush="Transparent" >
                                <Grid Name="myGrid" >
                                    <ContentPresenter />
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter TargetName="myBorder" Property="BorderBrush" Value="LightBlue" />
                                    <Setter TargetName="myGrid" Property="Background">
                                        <Setter.Value>
                                            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" Opacity="1">
                                                <GradientStop Color="Transparent" Offset="0" />
                                                <GradientStop Color="Blue" Offset="0.38" />
                                                <GradientStop Color="Transparent" Offset="1" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Foreground" Value="Black" />
                                </Trigger>
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter TargetName="myBorder" Property="BorderBrush" Value="LightBlue" />
                                    <Setter TargetName="myGrid" Property="Background">
                                        <Setter.Value>
                                            <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5" Opacity="0.1">
                                                <GradientStop Color="LightBlue" Offset="0" />
                                                <GradientStop Color="White" Offset="0.5" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Foreground" Value="Black" />
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="myBorder" Property="BorderBrush" Value="LightBlue" />
                                    <Setter TargetName="myGrid" Property="Background">
                                        <Setter.Value>
                                            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" Opacity="1">
                                                <GradientStop Color="Transparent" Offset="0" />
                                                <GradientStop Color="Blue" Offset="0.38" />
                                                <GradientStop Color="Transparent" Offset="1" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Foreground" Value="Black" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <DataTemplate x:Key="ListBoxDataTemplate">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Foreground="{StaticResource CommonTextBrush}" Grid.Row="0" Text="{Binding Postion}" TextWrapping="Wrap" FontSize="16" Margin="5" />
                    <Border Grid.Row="1" BorderThickness="1" BorderBrush="LightBlue" Margin="5">
                        <Image Source="{Binding ShotCut}" Height="101.25" Width="180" Stretch="Fill" />
                    </Border>

                    <!--<TextBlock Foreground="{StaticResource CommonTextBrush}" Grid.Row="0" Text="{Binding State.GamingScene.Role.Name}" TextWrapping="Wrap" FontSize="20" Margin="5" />-->
                    <!--<TextBlock Foreground="{StaticResource CommonTextBrush}" Grid.Row="1" Text="{Binding State.GamingScene.Dialogue.Text}" TextWrapping="Wrap" FontSize="20" Margin="5" HorizontalAlignment="Stretch" />-->
                    <TextBlock Foreground="{StaticResource CommonTextBrush}" Grid.Row="2" Text="{Binding CreateTime}" FontSize="16" Margin="5" HorizontalAlignment="Right" />
                    <Grid.ToolTip>
                        <ToolTip Background="Transparent">
                            <Grid>
                                <Image Grid.Column="0" Source="{Binding ShotCut}" Height="300"  Margin="5" />
                            </Grid>
                        </ToolTip>
                    </Grid.ToolTip>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>

    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="120" />
        </Grid.RowDefinitions>
        <TabControl Grid.Row="0" Name="myTabControl" />
        <Border Grid.Row="1" BorderThickness="1" BorderBrush="LightBlue" Margin="15,10,15,10">
            <StackPanel>
                <StackPanel.Background>
                    <SolidColorBrush Color="LightBlue" Opacity="0.2" />
                </StackPanel.Background>
                <TextBlock Text="Message:" FontSize="16" Margin="5"  />
                <TextBlock Text="{Binding ElementName=myTabControl,Path=SelectedContent.SelectedItem.State.GamingScene.Dialogue.Text}" Margin="5" FontSize="20" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
